
function appendMessage(userName='你'){
    let div = document.createElement('div');
    let message = document.querySelector('#text').value;
    let date = new Date;
    let now = `${date.getFullYear()}-${date.getMonth()+1}-${date.getDate()} ${date.getHours()}:${date.getMinutes()}:${date.getSeconds()}`;
    let messageBox = document.querySelector(".message-window");
    div.className = 'message'
    div.innerHTML = `<strong>${userName}:</strong> ${message}<br> <p style="font-size:1px">${now}</p>`
   
    // div.innerHTML = `<span class = "time">${now}</span>`
    // alert(now)
    messageBox.append(div)
    messageBox.scrollTop = messageBox.scrollHeight;
    
}
